<!DOCTYPE html>
<html>
<head>
<include file="Include:meta" />
<title>任务管理-目的地运营集团数据管理平台</title>
<link rel="stylesheet" href="__PUBLIC__/mobile/css/ion.rangeSlider.css">
<link rel="stylesheet" href="__PUBLIC__/mobile/css/ion.rangeSlider.skinFlat.css">
<include file="Include:style" />
<style>
    .two .sub_btn{ width: 30%; text-align: center; display: inline-block; margin: 10px 0; margin-right: 4%; line-height: 40px; height: 40px; }
    .two .dahui_btn{ background: #ff5879; }
    .two .giveup_btn{ background: none; border: 1px solid #ccc; color: #666; }
    .two .sub_btn:last-child{ margin-right: 0; }
	.two.three .sub_btn{ width: 25%; }
    .task_det .task_detail .meeting_cont ul{ padding: 0; }
    .task_det .task_detail .meeting_cont li .txt span{ color: #6eb500; }
    .task_det .task_detail .meeting_cont li .txt span.back{ color: #ff5879; }
    .dahui_alert{ color: #333; }
    .form_label{ width: 80px; }
    .meeting_cont{ padding-bottom: 35px !important; }
</style>
</head>
<body>
    <div class="task_det">
        <div class="header">
			<if condition="$pid neq NULL"><a class="menu_btn" href="javascript:;"><span class="sp1"></span><span class="sp2"></span><span class="sp3"></span></a><else /><if condition="$audit neq NULL"><a href="__APP__/Mobile/Index/audit_list" class="back_btn"><else /><a href="__APP__/Mobile/Project/task_list" class="back_btn"></if></a></if>
            任务详情
        </div>
        <include file="Include:commu_menu" />
        <div class="pro_det_title task">
            <img class="det_bg" src="__PUBLIC__/mobile/images/project/det_bg.jpg">
            <div class="txt">
                <h3> [{$project['project_num']}]</h3>
                <p>{$project['project_name']}</p>
            </div>
        </div>
        <div class="task_detail">
            <div class="introduce text_c shadbox">
                <div class="top">
                    <div <if condition="$result['status'] eq -1"><if condition="$result['start_date'] gt $today">class="icon c1"<elseif condition="$result['start_date'] elt $today and $result['end_date'] egt $today" />class="icon c2"<elseif condition="$result['end_date'] lt $today" />class="icon c3"</if><else />class="icon c4"</if>>
                        {$result['order_number']}
                    </div>
                    <h3>{$result['name']}</h3>
                    <div class="time">{$result['start_date']} ~ {$result['end_date']}</div>
                    <p>{$result['remark']}</p>
                </div>
                <ul class="thr clearboth">
                    <li><span>任务分类</span><if condition="$result['type1'] eq 75">{$result['type1_other']}<else />{$result['type1_name']}</if></li>
                    <li><span>任务子类</span><if condition="$result['type2'] eq 563">{$result['type2_other']}<else />{$result['type2_name']}</if></li>
                    <li><span>任务明细</span><if condition="$result['type3'] eq 161">{$result['type3_other']}<else />{$result['type3_name']}</if></li>
                </ul>
                <ul class="clearboth">
                    <li><span>负责人</span>{$result['head_user']}</li>
                    <li><span>督导</span>{$result['add_user']}</li>
                </ul>
                <if condition="$result['file_url'] eq NULL">
                <else />
                <div class="file text_l clearboth">
                    <div class="float_l">附件预览：</div>
					<foreach name="result['file_url']" item="vv" key="vkey">
					<div class="float_r"><a href="{$vv}">{$result['file_name'][$vkey]}</a></div>
                    </foreach>
                </div>
                </if>
            </div>
            <div class="arrange shadbox">
                <div class="shtit">
                    <span></span>人员安排
                </div>
                <ul>
					<if condition="$result_d eq NULL"><li>暂无相关内容</li></if>
					<foreach name="result_d" item="vo">
						<if condition="!(($pid eq NULL and (($result['head_uid'] eq $login_id) or ($result['add_uid'] eq $login_id))) or ($pid neq NULL and (((((get_permission($qs,NULL,3)) and ($project['add_uid'] eq $login_id)) or (get_permission($qs,NULL,2) and (in_array($project['center_id'],$manage_id))) or (get_permission($qs,NULL,1))) or ($project['director_uid'] eq $login_id) or ($project['manager_uid'] eq $login_id)) and ($project['status'] eq 1))))">
							<if condition="$login_id eq $vo['uid'] or $audit neq NULL">
								<li>
									<div class="tit">
										<em>{$vo['username']}</em> 截止日期：{$vo['end_date']}
										<if condition="(($pid eq NULL and (($result['head_uid'] eq $login_id) or ($result['add_uid'] eq $login_id))) or ($pid neq NULL and (((((get_permission($qs,NULL,3)) and ($project['add_uid'] eq $login_id)) or (get_permission($qs,NULL,2) and (in_array($project['center_id'],$manage_id))) or (get_permission($qs,NULL,1))) or ($project['director_uid'] eq $login_id) or ($project['manager_uid'] eq $login_id)) and ($project['status'] eq 1)))) and ($result['status'] eq -1)">
										<a class="icon_sub_btn ml5" href="javascript:void(0)"></a>
										<a class="icon_edit_btn ml5" href="__APP__/Mobile/Project/task_edit_pep/mid/{$vo['id']}/id/{$id}/pid/{$pid}/ppid/{$project['id']}"></a>
										<a class="icon_delete_btn" href="javascript:void(0)"></a>
										</if>
                                    </div>
                                    <div class="btxt">任务说明</div>
									<p>{$vo['note']}</p>
									<if condition="$vo['status'] neq -1">
                                        <div class="btxt">完结评语<span>{$vo['score']}分</span></div>
                                        <p>{$vo['score_comments']}</p>
                                    </if>
                                    <div class="file">
                                        <span>成果</span>
                                        <if condition="$vo['file_url'] neq NULL">
                                        <a class="down mr5 float_r" href="$vo['file_url']">{$vo['file_name']}</a>
                                        <else />
                                        <em>无</em>
                                        </if>
                                    </div>
                                </li>
							</if>
						<else />
							<li>
								<div class="tit">
									<em>{$vo['username']}</em> 截止日期：{$vo['end_date']}
									<if condition="(($pid eq NULL and (($result['head_uid'] eq $login_id) or ($result['add_uid'] eq $login_id))) or ($pid neq NULL and (((((get_permission($qs,NULL,3)) and ($project['add_uid'] eq $login_id)) or (get_permission($qs,NULL,2) and (in_array($project['center_id'],$manage_id))) or (get_permission($qs,NULL,1))) or ($project['director_uid'] eq $login_id) or ($project['manager_uid'] eq $login_id)) and ($project['status'] eq 1)))) and ($result['status'] eq -1) and $audit eq NULL">
										<if condition="$vo['status'] eq -1">
										<a class="icon_sub_btn ml5" href="javascript:void(0)" mid="{$vo['id']}"></a>
										<a class="icon_edit_btn ml5" href="__APP__/Mobile/Project/task_edit_pep/mid/{$vo['id']}/id/{$id}/pid/{$pid}/ppid/{$project['id']}"></a>
										<a class="icon_delete_btn" mid="{$vo['id']}" action="delete_user" href="javascript:void(0)"></a>
										</if>
									</if>
                                </div>
                                <div class="btxt">任务说明</div>
								<p>{$vo['note']}</p>
								<if condition="$vo['status'] neq -1">
                                    <div class="btxt">完结评语<span>{$vo['score']}分</span></div>
								    <p>{$vo['score_comments']}</p>
                                </if>
                                <div class="file">
                                    <span>成果</span>
                                    <if condition="$vo['file_url'] neq NULL">
                                    <a class="down mr5 float_r" href="$vo['file_url']">{$vo['file_name']}</a>
                                    <else />
                                    <em>无</em>
                                    </if>
                                </div>
							</li>
						</if>
					</foreach>
                </ul>
				<if condition="(($pid eq NULL and (($result['head_uid'] eq $login_id) or ($result['add_uid'] eq $login_id))) or ($pid neq NULL and (((((get_permission($qs,NULL,3)) and ($project['add_uid'] eq $login_id)) or (get_permission($qs,NULL,2) and (in_array($project['center_id'],$manage_id))) or (get_permission($qs,NULL,1))) or ($project['director_uid'] eq $login_id) or ($project['manager_uid'] eq $login_id)) and ($project['status'] eq 1)))) and ($result['status'] eq -1)">
                <a class="task_add" href="__APP__/Mobile/Project/task_add_pep/id/{$id}/pid/{$pid}/ppid/{$project['id']}"><i></i>新增人员安排</a>
				</if>
            </div>
			<if condition="(($pid eq NULL and (($result['head_uid'] eq $login_id) or ($result['add_uid'] eq $login_id))) or ($pid neq NULL and (((((get_permission($qs,NULL,3)) and ($project['add_uid'] eq $login_id)) or (get_permission($qs,NULL,2) and (in_array($project['center_id'],$manage_id))) or (get_permission($qs,NULL,1))) or ($project['director_uid'] eq $login_id) or ($project['manager_uid'] eq $login_id)) and ($project['status'] eq 1)))) and ($result['status'] neq -1) or $audit neq NULL">
            <div class="harvest shadbox">
                <div class="shtit">
                    <span></span>任务成果
                </div>
                <ul>
                    <li><span>总结</span><em>{$result['conclusion']}</em></li>
                    <li class="clearboth"><span>成果</span>
                        <if condition="$result['file_url_c'] neq NULL">
                        <foreach name="result['file_url_c']" item="vv" key="vkey">
							<a class="down mr5 float_r" href="{$vv}">{$result['file_name_c'][$vkey]}</a>
                        </foreach>
                        <else />
                        <i>无</i>
                        </if>
                    </li>
                </ul>
            </div>
            <div class="harvest shadbox meeting_cont">
                <div class="shtit">
                    <span></span>审核流程
                </div>
                <div class="person_list">
                    <ul>
                    <if condition="$result['status'] neq -1 or $result['dh_uid'] neq NULL or $result['submit_info'] neq NULL">
                        <if condition="$result['status'] neq -1">
                        <foreach name="audit_user" item="vo">
                            <if condition="$vo['audit_date'] neq NULL">
                                <li><div class="tit">{$vo['audit_name']}：{$vo['audit_user']}</div>
								<div class="txt">
								<span><if condition="$key eq 0">提出申请<else />审核通过</if></span>
								<p>{$vo['audit_user']}({$vo['audit_date']|substr=0,10})<if condition="$key eq 0">发起申请<else /><if condition="$vo['audit_comments'] neq NULL">:{$vo['audit_comments']}</if></if></p>
								</div>
								<if condition="$vo['dh_message'] neq NULL"><div class="txt"><span class="gray">审核打回</span><p>打回至"{$vo['arrive_name']}"({$vo['dh_date']|substr=0,10})原因:{$vo['dh_message']}</p></div></if><if condition="$vo['arrive_info'] neq NULL"><div class="txt"><p>"{$vo['arrive_name']}"({$vo['arrive_date']|substr=0,10})回复:{$vo['arrive_info']}</p></div></if>
								</li>
                            <else/>
                                <li><div class="tit">{$vo['audit_name']}：{$vo['audit_user']} <span>[未审核]</span></div><if condition="$vo['dh_message'] neq NULL"><div class="txt"><span class="back">审核打回</span><p style="color:red;">打回至"{$vo['arrive_name']}"({$vo['dh_date']|substr=0,10})原因:{$vo['dh_message']}</p></div></if><if condition="$vo['arrive_info'] neq NULL"><div class="txt"><p style="color:red;">"{$vo['arrive_name']}"({$vo['arrive_date']|substr=0,10})回复:{$vo['arrive_info']}</p></div></if></div></li>
                            </if>
                        </foreach>
                        </if>
                        <!--<if condition="$result['dh_uid'] neq NULL">
                            <li>
                                <div class="tit">打回原因</div>
                                <div class="txt">{$result['dh_user']}({$result['dh_date']|substr=0,10}):{$result['dh_message']}</div>
                            </li>
                        </if>
                        <if condition="$result['submit_info'] neq NULL">
                            <li>
                                <div class="tit">重新提交</div>
                                <div class="txt">{$result['submit_info']}</div>
                            </li>
                        </if>-->
                    </if>
                    </ul>
                </div>
            </div>
            </if>
        </div>
    </div>
<div class="build_btn text_c">
	<div class="two">
		<if condition="$audit neq ''">
			<if condition="$result['status'] egt 0">
				<div class="two">
                    <if condition="($qishen eq 1) and ($result['status'] neq 3)">
						<a class="sub_btn giveup_btn" status="{$result['status']}" stype="5" mid="{$result['id']}" href="javascript:;">弃审</a> 
					</if>
					<if condition="($shenhe eq 1)">
                        <a class="sub_btn dahui_btn" href="javascript:;" status="-1" mid="{$result['id']}" uuid="{$login_id}" active="2">打回</a>
                        <a class="sub_btn audit_btn" href="javascript:;" status="{$result['status']}" mid="{$result['id']}" uuid="{$login_id}" active="1">审核</a>
					</if>
				</div>
			</if>
		</if>
	</div>
</div>
<div class="Alert operate_alert score_alert">
    <div>
        <div class="photo"><span></span><p></p></div>
        <div class="range_con mb20 clearboth">
            <p>人员评分</p>
            <div class="range">
                <span class="fn">1</span><input type="text" id="range_1" name="score" /><span class="ln">10</span>
            </div>
        </div>
        <textarea name="score_comments" placeholder="点击填写评语…"></textarea>
        <div class="btn_box clearboth">
            <a class="btn_close float_l" href="javascript:;">取消</a><button class="btn_alert score_sub float_r disabled" active="1" disabled="">确定</button>
        </div>
        <input class="size_input" type="hidden" sid="" tid="">
    </div>
</div>
<!-- 弹出框 -->
<div class="Alert operate_alert audit_alert">
    <div>
        <p class="mb10">审核意见</p>
        <textarea name="sh_text"></textarea>
        <div class="btn_box clearboth">
            <a class="btn_close float_l" href="javascript:;">取消</a><button class="btn_alert bg_sub float_r disabled" active="1" disabled>确定</button>
        </div>
        <input class="size_input" type="hidden" sid="" tid="">
    </div>
</div>
<!-- 弹出框 -->
<div class="Alert operate_alert dahui_alert">
    <div>
        <p class="mb10">打回阶段</p>
        <div class="tab_btn">
           <foreach name="audit_list" item="vo"><a href="javascript:;" mid="{$vo['audit_sort']}">{$vo['audit_name']}</a></foreach>
        </div>
        <p class="mb10">是否重走流程</p>
        <div class="form_item mb20">
            <label class="form_label radio"><input type="radio" name="work_type" value="1">是</label>
            <label class="form_label radio"><input type="radio" name="work_type" value="-1">否</label>
        </div>
        <p class="mb10">打回原因</p>
        <textarea name="dh_text" style="height:100px" placeholder="请填写打回原因…"></textarea>
        <div class="btn_box clearboth">
            <a class="btn_close float_l" href="javascript:;">取消</a><button class="btn_alert float_r disabled" disabled>确定</button>
        </div>
        <input class="size_input" type="hidden" sid="" tid="">
    </div>
</div>
<include file="Include:javascript" />
<include file="Include:javascript" />
<script src="__PUBLIC__/mobile/js/ion.rangeSlider.min.js"></script>
<script>
    $(function(){
		$(".icon_delete_btn").ajaxModal({"body_text":"您确定要删除吗？","url":"/dms_erp/index.php?s=/Mobile/Project/task_ajax","data":{"id":"mid","action":"action"}});
        $('.task_detail').height($(window).height()-145);
        //弃审
        $(".giveup_btn").ajaxModal({"body_text":"您确定要弃审吗？","url":"/dms_erp/index.php?s=/Mobile/Index/audit_list_ajax","data":{"mid":"mid","status":"status","type":"stype"}});
		var size = $('.sub_btn').size();
		if(size>0){
			$('.task_detail').addClass('active')
		}
		if(size>2){
			$('.two').addClass('three')
		}
        //审核
        $('.audit_btn').on("click",function(){
            var status = parseInt($(this).attr('status'))+1,
                uuid = $(this).attr("uuid"),
                mid = $(this).attr("mid");
            Mask();
            $('.audit_alert').fadeIn().find('textarea').val('').focus();
            $('.audit_alert .btn_alert').attr("status",status);
            $('.audit_alert .btn_alert').attr("uuid",uuid);
            $('.audit_alert .btn_alert').attr("mid",mid);
        });
        $('.bg_alert .bg_sub').click(function(){
            var active = $(this).attr('active');
            if(active==1){
                var status = $(this).attr('status'),
                    uuid = $(this).attr("uuid"),
                    val = $(this).parents('.bg_alert').find('textarea').val(),
                    mid = $(this).attr("mid"); 

                $.ajax({
                    cache:true,
                    type:"POST",
                    dataType:"json",
                    url:"/dms_erp/index.php?s=/Mobile/Index/audit_list_ajax",
                    data:{"mid":mid,"status":status,"uuid":uuid,"audit_message":val,"type":"5"},
                    success:function(data){
                        success_pop(data['status'],data['msg']);
                    }
                });
            }else{
                var status = $(this).attr('status'),
                    uuid = $(this).attr("uuid"),
                    val = $(this).parents('.bg_alert').find('textarea').val(),
                    mid = $(this).attr("mid"); 

                $.ajax({
                    cache:true,
                    type:"POST",
                    dataType:"json",
                    url:"/dms_erp/index.php?s=/Mobile/Index/audit_list_ajax",
                    data:{"mid":mid,"status":status,"uuid":uuid,"dh_message":val},
                    success:function(data){
                        success_pop(data['status'],data['msg']);
                    }
                });
            }
        })
        //提交
        $('.audit_alert .btn_alert').click(function(){
            var status = $(this).attr('status'),
                uuid = $(this).attr("uuid"),
                state = 1,
                val = $(this).parents('.Alert').find('textarea').val(),
                mid = $(this).attr("mid"); 

            $.ajax({
                cache:true,
                type:"POST",
                dataType:"json",
                url:"/dms_erp/index.php?s=/Mobile/Index/audit_list_ajax",
                data:{"mid":mid,"status":status,"uuid":uuid,"state":state,"audit_message":val,"type":"5"},
                success:function(data){
                    success_pop(data['status'],data['msg']);
                }
            });
        })
        $('.dahui_alert .btn_alert').click(function(){
            var status = $(this).attr('status'),
                uuid = $(this).attr("uuid"),
				dh_status = "{$result['status']}",
                val = $(this).parents('.Alert').find('textarea').val(),
                btn = $(this).parents('.Alert').find('a.active').attr("mid"),
                lab = $(this).parents('.Alert').find('input:checked').val(),
                mid = $(this).attr("mid"); 
            
            $.ajax({
                cache:true,
                type:"POST",
                dataType:"json",
                url:"/dms_erp/index.php?s=/Mobile/Index/audit_list_ajax",
				data:{"mid":mid,"status":status,"flow_status":lab,"arrive_status":btn,"uuid":uuid,"dh_message":val,"dh_status":dh_status},
                success:function(data){
                    success_pop(data['status'],data['msg']);
                }
            });
        })
        $("[name='dh_text']").bind('input propertychange', function() {  
            var val = $(this).val();
            if(val!=''){
                submit();
            }else{
                $(".btn_alert").addClass("disabled").attr('disabled',true);
            }
        })
        $('.dahui_alert .btn_close').click(function(){
            $('.dahui_alert').find('.active').removeClass('active');
            $('.dahui_alert').find("[name='work_type']").attr("ckecked",false);
            $('.dahui_alert').find("textarea").val('');
            $('.dahui_alert .btn_alert').addClass('disabled').attr('disabled',true);
        })
        $('.audit_alert .btn_close').click(function(){
            $('.audit_alert').find("textarea").val('');
            $('.audit_alert .btn_alert').addClass('disabled').attr('disabled',true);
        })
        $("[name='sh_text']").bind('input propertychange', function() {  
            var val = $(this).val();
            if(val!=''){
                $('.audit_alert .btn_alert').removeClass('disabled').attr('disabled',false);
            }else{
                $(".audit_alert .btn_alert").addClass("disabled").attr('disabled',true);
            }
        })
        //打回
        $('.dahui_alert .tab_btn a').click(function(){
            $(this).addClass('active').siblings().removeClass('active');
            submit();
        })
        $('.dahui_alert .form_label').click(function(){
            submit();
        })
        $(".dahui_btn").on("click",function(){
            var mid = $(this).attr("mid"),
                uuid = $(this).attr("uuid"),
                status = $(this).attr("status");
            Mask();
            $('.dahui_alert').fadeIn().find('textarea').val('');
            $('.dahui_alert .btn_alert').attr("status",status);
            $('.dahui_alert .btn_alert').attr("uuid",uuid);
            $('.dahui_alert .btn_alert').attr("mid",mid);
        });

        menu();
        $("#range_1").ionRangeSlider({
            type: "single",
            min: 0,
            max: 10,
            step: 1,
            postfix: "分",
            grid: false,
            grid_snap: true
        });
        $('.icon_sub_btn').click(function(){
            $('.score_alert').fadeIn();
            Mask();
        })
        $('#range_1').change(function(){
            submit();
        })
        $("[name='score_comments']").bind('input propertychange', function() { 
            submit();
        })
        function submit(){
            var tag = true;
            if($('#range_1').val()==0){
                $(".score_sub").addClass("disabled").attr('disabled',true);
                tag = false;
            }
            if($("[name='score_comments']").val()==''){
                $(".score_sub").addClass("disabled").attr('disabled',true);
                tag = false;
            }
            if(tag){
                $(".score_sub").removeClass("disabled").attr('disabled',false);
            }
        }
        $('.arrange .icon_sub_btn').click(function(){
            var mid = $(this).attr('mid');
                
            $('.score_sub').attr('mid',mid);
            $('.photo p').html($(this).siblings('em').text());
        })
        $('.score_sub').click(function(){
            var mid = $(this).attr('mid'),
                score = $('#range_1').val(),
                score_comments = $("[name='score_comments']").val();

            $.ajax({
                type: 'POST',
                async:false,
				dataType:"json",
                data:{"mid":mid,"score":score,"score_comments":score_comments,"action":"end_user"},
                url:"__APP__/Mobile/Project/task_ajax",
                dataType: 'json',
                success: function(data){
                    success_pop(data.status,data.msg);
                }
            })
        })
        //打回提交
		function submit(){
            var tag = true;

			if($('.tab_btn .active').length<1){
				tag = false;
                $('.dahui_alert .btn_alert').addClass('disabled').attr('disabled',true);
			}
            if($('.form_item .active').length<1){
				tag = false;
                $('.dahui_alert .btn_alert').addClass('disabled').attr('disabled',true);
			}
			$("[name='dh_text']").each(function(){
				if($(this).val()==''){
					tag = false;
					$('.dahui_alert .btn_alert').addClass('disabled').attr('disabled',true);
				}
			})
            if(tag){
                $('.dahui_alert .btn_alert').removeClass('disabled').attr('disabled',false);
            }
        }
    })
</script>
</body>
</html>